<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
      </head>
      <body>
        <script>
          //1. 打印0-20之间的整数, 将每个数输出到控制台

          for(let i = 0;i<=20;i++){
            if(i % 1 ===0)
            console.log(i);
          }




          //2. 计算1-1000之间的和

          let j=0
          for(let i =1;i <=1000;i++){
            j +=i
          }
          document.write(j);



          // 3.打印 100-200之间,可以被6整除的数字


          for(let i =100;i <=200;i++){
            if(i % 6 === 0){
              console.log(i);
            }
          }



          // 4.用户输入一个数，  计算 1 到这个数的和。


          let num=+prompt('请输入数字')
          let num1=0
          for(let i =0;i <= num;i++){
           num1 =num1 + i
          }
          console.log(num1);
        </script>
      </body>
    </html>
  </body>
</html>
